<h2>Modify Volume</h2>
<hr/>
<p>To modify the volume information, enter valid information into the following fields:</p>
<center>
<div class="errorval"><?php echo validation_errors(); ?>
<?php echo $error; ?></div>
<table>
<?php echo form_open('admin/catalogue_management/modifyVolume/' . $volume->access_id); ?>
<tr>
	<th width=20% align="right">Accession Number:</th>
	<td><?php echo form_input('access_id', $volume->access_id); ?></td>
</tr>
<tr>
	<th align="right">Call Number:</th>
	<td><?php echo form_input('call_number', $volume->call_number); ?></td>
</tr>
<tr>
	<th align="right">Title:</th>
	<td><?php echo form_input('title', $volume->title); ?></td>
</tr>
<tr>
	<th align="right">Publisher Name:</th>
	<td><?php echo form_input('publisher_name', $volume->publisher_name); ?></td>
</tr>
<tr>
	<th align="right">Publisher Year:</th>
	<td><?php echo form_input('publisher_date', $volume->publisher_date); ?></td>
</tr>
<tr>
	<th align="right">ISBN:</th>
	<td><?php echo form_input('isbn', $volume->isbn); ?><p name="isbn_error"></p></td>
</tr>
<tr>
	<th align="right">*Location:</th>
	<?php
	$options = array();
	
	foreach ($locations as $location)
		$options[$location->location_id] = $location->location_name;
	
	?>
	<td colspan=2><?php echo form_dropdown('location_id', $options, $volume->location_id); ?></td>
</tr>
<tr>
	<th align="right">Catalogue Date:</th>
	<td><?php echo form_input('catalogue_date', $volume->catalogue_date); ?></td>
</tr>
<tr>
	<th align="right" class="tablehead">Actions</th>
	<td><?php echo form_submit('', 'Submit'); ?></td>
</tr>
<?php echo form_close(); ?>
</table>
</center>

<script type="text/javascript">
$(document).ready(function() {
		//$( '[name="publisher_date"]' ).datepicker({ dateFormat: 'yy', changeYear: true });
		$( '[name="catalogue_date"]' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true });
		addAutocomplete('[name="call_number"]', '<?php echo site_url('admin/jquery/autocomplete/tbl_volume/call_number'); ?>');
		addAutocomplete('[name="title"]', '<?php echo site_url('admin/jquery/autocomplete/tbl_volume/title'); ?>');
		addAutocomplete('[name="publisher_name"]', '<?php echo site_url('admin/jquery/autocomplete/tbl_volume/publisher_name'); ?>');
		
		$("[name=isbn]").keyup( function(){
			var isbn = $("[name=isbn]").val();
			if ( !validateISBN(isbn) )
				$('[name=isbn_error]').html("Invalid ISBN");
				
			else
				$('[name=isbn_error]').html("");
		});
});
</script>

